package aad.storyboard.model.menu;

import aad.storyboard.R;
import aad.storyboard.model.Story;
import aad.storyboard.model.Image;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Typeface;
import android.view.Gravity;
import android.widget.LinearLayout;
import android.widget.SeekBar;

/**
 * example of concrete builder class, overrides the needed methods to create a set of plain, centralized menus
 */
public class PlainCentralizedMenuBuilder extends MenuBuilder{
	
	public PlainCentralizedMenuBuilder(Story s) {
		super(s);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void createText(String t) {
		MenuItem text = new MenuItem();
		text.setId(MenuItem.Action.NONE);
		text.setText(t);
		text.setPosX(50);
		text.setWidth(80);
		text.setPosY(20);
		text.setGravity(Gravity.CENTER);
		menu.setText(text);
		
	}

	@Override
	public void createTitle(String t) {
		MenuItem title = new MenuItem();
		title.setId(MenuItem.Action.NONE);
		title.setText(t);
		title.setTextColor(Color.RED);
		title.setTextSize(4);
		title.setPosX(50);
		title.setWidth(70);
		title.setPosY(8);
		title.setGravity(Gravity.CENTER);
		menu.setTitle(title);
	}
	

	@Override
	public void createStartButton() {
		MenuItem sButton = new MenuItem();
		sButton.setText("Start");
		sButton.setId(MenuItem.Action.START);
		sButton.setHeight(10);
		menu.addSelectionItem(sButton);
	}

	@Override
	public void createChapterButton() {
		MenuItem cButton = new MenuItem();
		cButton.setText("Chapters");
		cButton.setId(MenuItem.Action.CHAPTER);
		cButton.setHeight(10);
		menu.addSelectionItem(cButton);
	}

	@Override
	public void createAboutButton() {
		MenuItem aButton = new MenuItem();
		aButton.setText("About");
		aButton.setId(MenuItem.Action.ABOUT);
		aButton.setHeight(10);
		menu.addSelectionItem(aButton);
	}

	@Override
	public void createExitButton() {
		MenuItem eButton = new MenuItem();
		eButton.setText("Exit");
		eButton.setId(MenuItem.Action.EXIT);
		eButton.setHeight(10);
		menu.addSelectionItem(eButton);
	}

	@Override
	public void createResumeButton() {
		MenuItem rButton = new MenuItem();
		rButton.setText("Resume");
		rButton.setId(MenuItem.Action.RESUME);
		rButton.setHeight(10);
		menu.addSelectionItem(rButton);
	}

	@Override
	public void createRestartButton() {
		MenuItem rButton = new MenuItem();
		rButton.setText("Restart");
		rButton.setId(MenuItem.Action.RESTART);
		rButton.setHeight(10);
		menu.addSelectionItem(rButton);
	}

	@Override
	public void createMainMenuButton() {
		MenuItem mButton = new MenuItem();
		mButton.setText("Main Menu");
		mButton.setId(MenuItem.Action.MAIN_MENU);
		mButton.setHeight(10);
		menu.addSelectionItem(mButton);
	}
	
	public void createMenuImage(){
		Image img = story.getStoryImage();
		img.setPosX(0);
		img.setPosY(0);
		img.setWidth(100);
		
	}

	@Override
	public void createLookSettings() {
		MenuSettings settings = new MenuSettings(1,Gravity.CENTER,LinearLayout.VERTICAL,30,50);
		settings.setWidth(80);
		menu.setColor(Color.WHITE);
		menu.setBackground(R.drawable.jabberwocky);
		menu.setMenuSettings(settings);
	}
	
	@Override
	public void createSceneSelectionButton(int i) {

		MenuItem sButton = new MenuItem();
		sButton.setText("Scene "+Integer.toString(i));
		sButton.setId(MenuItem.Action.SCENE);
		sButton.setIdx(i);
		sButton.setHeight(10);
		menu.addSelectionItem(sButton);
	}
	
	@Override
	public void createChapterSelectionButton(int i){
		MenuItem sButton = new MenuItem();
		sButton.setText("Chapter "+Integer.toString(i));
		sButton.setIdx(i);
		sButton.setId(MenuItem.Action.CHAPTERSELECTION);
		sButton.setHeight(10);
		menu.addSelectionItem(sButton);
	}

	public void createVolumeController() {
		MenuItem sButton = new MenuItem();
		sButton.setId(MenuItem.Action.NONE);
		sButton.setText("Volume");
		sButton.setWidth(50);
		sButton.setHeight(10);
		sButton.setType(MenuItem.ADJUSTMENT);
		sButton.setGravity(Gravity.CENTER);
		sButton.setTag(MenuItem.VOLUME);
		menu.addSelectionItem(sButton);
		
	}

	public void createWikiButton() {
		MenuItem sButton = new MenuItem();
		sButton.setText("WikiMode");
		sButton.setId(MenuItem.Action.NONE);
		sButton.setWidth(50);
		sButton.setHeight(10);
		sButton.setGravity(Gravity.CENTER);
		sButton.setType(MenuItem.SWITCH);
		sButton.setTag(MenuItem.WIKI);
		menu.addSelectionItem(sButton);
	}

	public void createScriptButton() {
		MenuItem sButton = new MenuItem();
		sButton.setText("Scripts");
		sButton.setId(MenuItem.Action.NONE);
		sButton.setWidth(50);
		sButton.setHeight(10);
		sButton.setGravity(Gravity.CENTER);
		sButton.setType(MenuItem.SWITCH);
		sButton.setTag(MenuItem.SCRIPT);
		menu.addSelectionItem(sButton);
	}
	
	public void createSettingsButton(){
		MenuItem sButton = new MenuItem();
		sButton.setText("Settings");
		sButton.setId(MenuItem.Action.SETTINGS);
		sButton.setHeight(10);
		menu.addSelectionItem(sButton);
		
	}
	

	@Override
	public void createBookMarkButton(String data) {
		MenuItem mButton = new MenuItem();
		mButton.setText("Scene "+data);
		mButton.setId(MenuItem.Action.BOOKMARKS);
		mButton.setHeight(10);
		mButton.setTag(Integer.parseInt(data.substring(0,1)));
		menu.addSelectionItem(mButton);
	}
	
	@Override
	public void createSaveBookMarkButton() {
		MenuItem mButton = new MenuItem();
		mButton.setText("Save Bookmark");
		mButton.setId(MenuItem.Action.STORE_BOOKMARK);
		mButton.setHeight(10);
		menu.addSelectionItem(mButton);
	}
	

	public void createBookmarkSelectionButton() {
		MenuItem mButton = new MenuItem();
		mButton.setText("Bookmarks");
		mButton.setId(MenuItem.Action.BOOKMARKMENU);
		mButton.setHeight(10);
		menu.addSelectionItem(mButton);
		
	}
	

}
